#!/usr/bin/sh

# usermod --shell /bin/bash root  https://www.cnblogs.com/Hackerman/p/16063299.html
# echo "password" | passwd  root --stdin > /dev/null 2>&1
# chsh -s /usr/bin/zsh
echo root:root|chpasswd && usermod --shell /bin/zsh root
mkdir -p /root/code

# # create user
# ENV HOME /home/lgf
# # RUN groupadd -r lgf && useradd -r -m -g  lgf lgf
# groupadd -r lgf
# useradd --create-home --home-dir $HOME -r -g lgf lgf
# echo "lgf:lgf" | chpasswd
# echo "lgf ALL=(ALL)  NOPASSWD:ALL" >> /etc/sudoers
username=lgf
# useradd -d /home/$username -s /bin/zsh -m $username #用户生成在/home
useradd -m -s /bin/bash -G sudo,root $username # ubuntu
# useradd -m -s /bin/zsh -G wheel $username # centos
# echo $ username"123" | paswd --stdin $username
echo "$username:$username" | chpasswd  #设置默认密码
echo "User $username Create Success!"
echo "$username ALL=(ALL)  NOPASSWD:ALL" >> /etc/sudoers
mkdir -p /home/$username
mkdir -p /home/$username/code